<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1" import="org.apak.model.*"
	import="java.util.*"%>
<%
	JspWriter outPrint = pageContext.getOut();
	ArrayList<ServiceNote> listOfCustomerServiceNotes = (ArrayList<ServiceNote>) request
			.getAttribute("customerNotes");
	boolean noteExist = false;
	if(listOfCustomerServiceNotes.size() > 0) {
		for (ServiceNote note : listOfCustomerServiceNotes) {
			if(note.getService_order_fk() == (Integer) request.getAttribute("currentServiceOrderNumber")) {
				outPrint.println("<span>" + note.getNote() + "</span>");
				outPrint.print("<input type=\"button\" id=\"editNote\" value=\"Edit note\"/><input type=\"button\" id=\"saveChangesNote\" data-service_order=\"" + (Integer) request.getAttribute("currentServiceOrderNumber") +"\" value=\"Save changes\" style=\"display: none;\"/>");
				noteExist = true;
			}

		}
	} 
	if(!noteExist) {
		outPrint.print("<input type=\"button\" id=\"addNote\" value=\"Add note\"/>");
		outPrint.println("<div id=\"noteDiv\" style=\"display: none;\">");
		outPrint.println("<textarea id=\"noteArea\"></textarea><br />");
		outPrint.println("<input type=\"button\" name=\"saveNote\" id=\"saveNote\" data-service_order=\"" + (Integer) request.getAttribute("currentServiceOrderNumber") +"\" value=\"Save note\"/>");
		outPrint.println("</div><br />");
	}

%>